package blaha.genalg.beans;

/**
 * Class describe connection between two points. Between every two points there
 * exists such class. Important is, if "connected". Also second level routes can
 * coexist with normal routes...take abus or a plane to Moscow?:) Strict mean,
 * the plane should be more expensive than bus(less time=more expensive)
 * 
 * @author uziv
 * 
 */
public class NonWeightedEdge {

	// private static final Logger log = Log.getLoggerMoje();

	/**
	 * Second level should cost more than first Level, maybe other constrains
	 * may come with time
	 */
	// boolean strictSecondLevel = false;

	// distance between points
	float SLdistance = -1f;
	public float SLweigth = -1f;
	float distance = -1f;
	float weigth = -1f;

	// are they connected?
	boolean connected = false;
	boolean SLconnected = false;

	public float getDistance() {
		if (!this.connected)
			distance = -1f;
		return distance;
	}

	public void setDistance(Float distance) {
		this.distance = distance;
	}

	public float getWeigth() {
		if (!this.connected)
			weigth = -1f;
		return weigth;
	}

	public void setWeigth(Float weigth) {
		this.weigth = weigth;
	}

	public boolean isConnected() {
		if ((this.weigth < 0) || (this.distance < 0))
			return false;
		return connected;
	}

	public void setConnected(boolean connected) {
		this.connected = connected;
	}

	// ### SL=Second Level routes ###

	public float getSLDistance() {
		if (!this.SLconnected)
			SLdistance = -1f;
		return SLdistance;
	}

	public void setSLDistance(Float SLdistance) {
		this.SLdistance = SLdistance;
	}

	public float SLgetWeigth() {
		if (!this.SLconnected)
			SLweigth = -1f;
		return SLweigth;
	}

	// public void setSLWeigth(Float SLweigth) {
	// if (strictSecondLevel)
	// if (SLweigth < this.weigth)
	// this.SLweigth = -1f;
	// this.SLweigth = SLweigth;
	// }

	public boolean isSLConnected() {
		if ((this.SLweigth < 0) || (this.SLdistance < -1f))
			return false;
		return SLconnected;
	}

	public void setSLConnected(boolean SLconnected) {
		this.SLconnected = SLconnected;

	}

	// public boolean isStrictSecondLevel() {
	// return strictSecondLevel;
	// }
	//
	// public void setStrictSecondLevel(boolean strictSecondLevel) {
	// this.strictSecondLevel = strictSecondLevel;
	// }

	// public float getSLweigth() {
	// return SLweigth;
	// }

}
